package com.universest.swordholder.viewmodel

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.Chat
import androidx.compose.material.icons.filled.LocalLibrary
import androidx.compose.material.icons.filled.Person
import androidx.compose.ui.graphics.vector.ImageVector
import com.universest.swordholder.R
import com.universest.swordholder.getApplicationContext
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow

data class Tab(
    val id: Int = 0,
    val title: String = "",
    val icon: ImageVector
)

class MainScreenViewModel : BaseViewModel() {

    val tabWorks = Tab(title = getApplicationContext().getString(R.string.works), icon = Icons.Default.LocalLibrary,id = 0)
    val tabChat = Tab(title = getApplicationContext().getString(R.string.chat), icon = Icons.AutoMirrored.Default.Chat,id = 1)
    val tabMe = Tab(title = getApplicationContext().getString(R.string.me), icon = Icons.Default.Person,id = 2)

    private var _tabs = MutableStateFlow<List<Tab>>(listOf(
        tabWorks,tabChat,tabMe
    ))

    val tabs = _tabs.asStateFlow()

    private var _currentTab = MutableStateFlow<Tab>(tabWorks)

    val currentTab = _currentTab.asStateFlow()

    fun setCurrentTab(tab: Tab) {
        _currentTab.value = tab
    }
}